import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    authorization: '',
  },
  mutations: {
    setAuthorization (state, authorizaion) {
      state.authorization = authorizaion
    }
  },
  actions: {
    // changeAuthorization(context,param){
    //   context.commit("setAuthorization",param);
    //
    // },
    changeAuthorization: (context, param) => {
      // if()
    },
  },
  getters: {
    getAuthorization: state => {
      if (!state.authorization) {
        let authorization = window.localStorage.getItem('authorization')
        state.authorization = authorization == null ? '' : authorization
      }
      return state.authorization;
    },
  },
  modules: {}
})
